<!--
 * @Author: IBOSS 2776641037@qq.com
 * @Date: 2025-08-04 11:22:55
 * @LastEditors: IBOSS 2776641037@qq.com
 * @LastEditTime: 2025-08-04 11:58:10
 * @FilePath: \nuxt-js\pages\asyncData.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <!-- 异步加载数据 -->
  <div>
    <nuxt-link to="/" class="button--green">
      首页8
    </nuxt-link>

    <p>{{ name }}</p>

    <div>
      <pre>{{ list }}</pre>
    </div>
  </div>
</template>

<script>
export default {
  name: 'AsyncData',
  // axios 在服务端调用接口
  async asyncData (params) {
    // params 就是 this
    // console.log('params', params)

    // 调用axios
    const { data: res } = await params.$axios.get('https://queen.njzshm.com/adminapi/cms/cms?pid=0&title=&page=1&limit=20')
    console.log('res', res.data)
    console.log('1111', res)

    if(res.status ==200){

      

    }else if(res.status == 410000){

      console.log('msg', res.msg)
           

    }

    // 数据赋值给 data
    return {
      list: res.data
    }
  },
  data () {
    return {
      name: '获取网易新闻列表',
      list: []
    }
  },
  created () {
    //console.log('resdata', this.list) 
  }
}
</script>

<style>
</style>
